<?php

date_default_timezone_set('Europe/Paris');

include ($harliane_home . DIRECTORY_SEPARATOR . 'yii_config.php');
include ($harliane_home . DIRECTORY_SEPARATOR . 'functions.php');

if (!file_exists($local_home . DIRECTORY_SEPARATOR . 'assets'))
	mkdir($local_home . DIRECTORY_SEPARATOR . 'assets', 0777);
	
if (!file_exists($local_home . DIRECTORY_SEPARATOR . 'css') || (isset($force_res_copy) && $force_res_copy === true))
	smartCopy($harliane_home .
	DIRECTORY_SEPARATOR . 'css', $local_home . DIRECTORY_SEPARATOR . 'css', array (
		'folderPermission' => 0644,
		'filePermission' => 0644
	));
	
if (!file_exists($local_home . DIRECTORY_SEPARATOR . 'images') || (isset($force_res_copy) && $force_res_copy === true))
	smartCopy($harliane_home .
	DIRECTORY_SEPARATOR . 'images', $local_home . DIRECTORY_SEPARATOR . 'images', array (
		'folderPermission' => 0644,
		'filePermission' => 0644
	));
	
if (!file_exists($local_home . DIRECTORY_SEPARATOR . 'js') || (isset($force_res_copy) && $force_res_copy === true))
	smartCopy($harliane_home .
	DIRECTORY_SEPARATOR . 'js', $local_home . DIRECTORY_SEPARATOR . 'js', array (
		'folderPermission' => 0644,
		'filePermission' => 0644
	));

if (!file_exists($local_home . DIRECTORY_SEPARATOR . 'ckeditor'))
	smartCopy($harliane_home .
	DIRECTORY_SEPARATOR . 'ckeditor', $local_home . DIRECTORY_SEPARATOR . 'ckeditor', array (
		'folderPermission' => 0644,
		'filePermission' => 0644
	));

	$params = include ($harliane_home . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'main.php');
if (isset ($name) && $name != "")
	$params['name'] = $name; //'Le fil d\'Harliane (Tests)';

defined('YII_DEBUG') or define('YII_DEBUG', true);

require_once ($yii);
$v = Yii::createWebApplication($params);
$v->setLanguage(Yii::app()->user->getLanguage());
$v->clientScript->registerCoreScript('jquery');

Yii::app()->db->createCommand("SET NAMES UTF8")->execute();

$v->run();
